#pragma once
using namespace std;
#include <string>
#include <vector>
#include "WorldMap.h"
#include "../SGD Wrappers/SGD_Geometry.h"

#define HZ_SLOW 0.1f
#define HZ_DAMAGE 5

class CAgent;
class CBall;

class CTileManager
{
public:
	static CTileManager*	GetInstance();
	static void DeleteInstance();

	//Handles Tile Collision
	//Will see which tiles the feet collide with and applies affects to the collider
	void AgentCollision(const SGD::Rectangle &footRect, CAgent* collider );

	//Will check if ball enters goal
	bool BallCollision(const SGD::Rectangle &footRect, CBall* collider);

	// Get the entity spawn point at the selected index
	SGD::Point SpawnEntity(int index);

	// Get the waypoint for the specific enemy
	SGD::Point GetWaypoints(int index);

	// Get the number of waypoints for the specific enemy
	int GetNumWaypoints(int index);

	// Get the count
	int GetCount(int index) const { return m_nCount[index]; }

	// Get the tile width/height
	float GetTileWidth() const { return m_pMap->m_szTileSize.width; }
	float GetTileHeight() const { return m_pMap->m_szTileSize.height; }

	//Loads a map from an xml file
	void LoadLevel(char* filePath);
	//Dumps the crap from the level
	void UnloadLevel();
	//Saves the game
	void SaveLevel(char* filePath);

	void Render();
	void Update(float dt);

protected:
	CWorldMap* m_pMap = nullptr;
	static CTileManager* s_pInstance;
	CTileManager() = default;
	~CTileManager();

	CTileManager(const CTileManager&) = delete;
	CTileManager& operator=	(const CTileManager&) = delete;

	vector<SGD::Point> m_EntitySpawns;

	// Number of entities to spawn
	vector<int> m_nCount;

	// Enemy waypoints
	vector <SGD::Point> m_EnemyWaypoints;

	// Number of waypoints per enemy
	vector <int> m_nNumWaypoints;
};

